import sys
import os
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel
from gui.login_window import LoginWindow

# 将项目根目录添加到模块搜索路径
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, project_root)

class MainWindow(QWidget):
    def __init__(self):
        super().__init__()
        self.init_ui()

    def init_ui(self):
        self.setWindowTitle('周报分析器主界面')
        self.setGeometry(100, 100, 600, 400)

        layout = QVBoxLayout()
        label = QLabel('欢迎使用周报分析器！', self)
        layout.addWidget(label)

        self.setLayout(layout)

if __name__ == '__main__':
    app = QApplication(sys.argv)

    login_window = LoginWindow()
    main_window = MainWindow()

    login_window.login_success.connect(main_window.show)

    login_window.show()
    sys.exit(app.exec_())
    # 删除多余的代码
    # ex = App()
    # sys.exit(app.exec_())